package at.fhooe.stefanirndorfer.raycast;

import at.fhooe.stefanirndorfer.util.Vector2D;

/**
 * 
 * @author stefanirndorfer
 *
 */
public class AcousticScanner {

	
	public static int NUM_RAYS = 8;
	
	
	double angularStepWidth;
	
	public AcousticScanner(){
		calcAngularStepWidth();
	}
	
	/**
	 * this is the major work of the class
	 * @param x
	 * @param y
	 * @param width
	 * @param height
	 */
	public void scan(double x, double y, double width, double height) {
		Vector2D currPos = new Vector2D(x, y);
		double angle = 0;
		
		for (int i = 0; i < NUM_RAYS; i++) {
			angle = angularStepWidth*i;
			Vector2D dir = new Vector2D(currPos.x* Math.cos(angle) + currPos.y*Math.sin(angle), currPos.x * -Math.sin(angle) + currPos.y * Math.cos(angle));
			Vector2D v = new Ray(currPos,dir, geometryManager).hits();
		}
	}
	
	public void setNumRays(int numRays){
		NUM_RAYS = numRays;
		
	}

	private double calcAngularStepWidth() {
		return angularStepWidth = 2*Math.PI /NUM_RAYS;
	}

}
